home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Frameworks / MADE 1.0.1 / User Functions.c < prev   
Encoding:
Text File  |  1997-06-04  |  2.9 KB  |  171 lines  |  [TEXT/CWIE]

  1. // MADE - Macintosh Application Development Essentials
  2. // ---------------------------------------------------
  3.  
  4. // (c) Gideon Greenspan, Sig Software - June 1997 - http://www.kagi.com/gdg/
  5.  
  6. // These files can only be used for experimental standalone purposes. To obtain
  7. // fully commented code, and licenses for standalone, shareware, internal and
  8. // commercial usage, run the enclosed Register application.
  9.  
  10. // User Functions.c
  11. //
  12. // Off the shelf responses, which should be replaced with your code, and moved to other files.
  13. //
  14. // Version 1.0.0 - 10th November 1996
  15.  
  16. #include "Essential Headers.h"
  17. #include "Essential Prototypes.h"
  18.  
  19. enum {
  20.     FileStart=129*65536,
  21.     FileNew,
  22.     FileOpen,
  23.     FileSep1,
  24.     FileClose,
  25.     FileSave,
  26.     FileSaveAs,
  27.     FileSep2,
  28.     FilePageSetup,
  29.     FilePrint,
  30.     FileSep3,
  31.     FileQuit,
  32.     
  33.     EditStart=130*65536,
  34.     EditUndo,
  35.     EditSep1,
  36.     EditCut,
  37.     EditCopy,
  38.     EditPaste,
  39.     EditClear
  40.     
  41. };
  42.     
  43. void MyInitialiseApplication()
  44. {
  45. }
  46.  
  47. void MyClearUpApplication()
  48. {
  49. }
  50.  
  51. #if Use_AppleEvents
  52.     
  53.     #if Handle_Open_Documents_Event
  54.     
  55.         void MyOpenDocument(FSSpec* fileSpec)
  56.         {
  57.         }
  58.         
  59.     #endif
  60.     
  61.     #if Handle_Print_Documents_Event
  62.     
  63.         void MyPrintDocument(FSSpec* fileSpec)
  64.         {
  65.         }
  66.         
  67.     #endif
  68.     
  69. #endif
  70.  
  71. #if Use_Drag_Manager
  72.  
  73.     RgnHandle MyGetDragRegion(WindowPtr inWindow, Point localPoint, DragReference dragRef)
  74.     {
  75.         return 0;
  76.     }
  77.     
  78.     void MyReceiveDrag(WindowPtr inWindow, Point localPoint, DragReference dragRef)
  79.     {
  80.     }
  81.     
  82. #endif    
  83.  
  84. void MySetTheCursor(Point localPoint)
  85. {
  86.     ShowResCursor(plusCursor);
  87. }
  88.  
  89. void MyPerformIdleTasks()
  90. {
  91. }
  92.  
  93. void MyFreeUpMemory(Size spaceNeeded)
  94. {
  95. }
  96.  
  97. void MyEnableMenus()
  98. {
  99.     EnableMenuItem(129, 4, frontWindow!=0);
  100. }
  101.  
  102. void MyPerformMenu(long selection)
  103. {
  104.     Rect    windowRect;
  105.     
  106.     switch (selection) {
  107.         case FileNew:
  108.             SetRect(&windowRect, 48, 48, 256, 256);
  109.             NewWindow(0, &windowRect, "\p", true, documentProc, (WindowPtr)-1, true, 0);
  110.             break;
  111.         
  112.         case FileClose:
  113.             MyCloseWindow();
  114.             frontWindow=0;
  115.                 // It is essential that this is done whenever the front window is closed,
  116.                 // otherwise it will seem to the rest of MADE that the window is still open
  117.             break;
  118.         
  119.         case FileQuit:
  120.             applicationHasQuit=true;
  121.             break;
  122.     }
  123. }
  124.  
  125. void MyDrawWindow(WindowPtr drawWindow)
  126. {
  127.     if (((WindowPeek)drawWindow)->hilited) PaintRgn(drawWindow->visRgn);
  128.     else InvertRgn(drawWindow->visRgn);
  129. }
  130.  
  131. void MyHandleKeyDown(char keyCharacter, short modifiers)
  132. {
  133. }
  134.  
  135. void MyHandleMouseDown(Point localPoint, short modifiers)
  136. {
  137.     Rect    eraseOval;
  138.     
  139.     do {
  140.         SetRect(&eraseOval, localPoint.h-2, localPoint.v-2, localPoint.h+2, localPoint.v+2);
  141.         EraseOval(&eraseOval);
  142.         
  143.         GetMouse(&localPoint);
  144.     } while (StillDown());
  145. }
  146.  
  147. void MyCloseWindow()
  148. {
  149.     DisposeWindow(frontWindow);
  150. }
  151.  
  152. void MyActivateWindow()
  153. {
  154.     InvalRgn(frontWindow->visRgn);
  155. }
  156.  
  157. void MyDeactivateWindow()
  158. {
  159.     InvalRgn(frontWindow->visRgn);
  160. }
  161.  
  162. void MyResizeBounds(Rect* growLimits)
  163. {
  164.     SetRect(growLimits, 128, 64, qd.screenBits.bounds.right,
  165.         qd.screenBits.bounds.bottom);
  166. }
  167.  
  168. void MySizedWindow()
  169. {
  170. }
  171.